//
// Created by root on 4/29/17.
//

#include "../runner.h"

static void test_op_let() {
    assert_string_equal(interpret("(let ((x 2) (y 5)) (*: x y))"), "10");
}

static void test_op_letstar() {
    assert_string_equal(interpret("(let* ((x 1) (y (+: x 1))) (cons y x))"), "(2 . 1)");
}

static void test_op_letrec() {
    assert_string_equal(interpret("(letrec ((x (lambda () (+: y y))) (y 100)) (+: (x) y))"), "300");
}

int main(int argc, char **argv) {
    const struct CMUnitTest tests[] = {
            cmocka_unit_test(test_op_let),
            cmocka_unit_test(test_op_letstar),
            cmocka_unit_test(test_op_letrec),
    };
    return cmocka_run_group_tests(tests, setup_scheme, teardown_scheme);
}
